package com.cyzy.utils;

import java.util.Random;

/**
 * 验证码生成工具类
 * @author LIGHT
 */
public class CodeGenerator {

    /**
     * 生成指定长度的数字验证码
     * @param length 验证码长度
     * @return 生成的验证码
     */
    public static String generateNumericCode(int length) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            sb.append(random.nextInt(10));
        }
        return sb.toString();
    }
}